package cn.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import cn.domain.Student;
import cn.service.StudentService;

@Controller
public class StudentController {
  
	
@Autowired
private  StudentService studentService;

@RequestMapping("/list")
public String   findStudentList(@RequestParam(value="pn",defaultValue="1")Integer pn,Model  model )
{
	String  relsut="main";
	//引入分页插件
	PageHelper.startPage(pn,7);
	//查询所有学生列表
	List<Student> students = studentService.findStudentList();
	//显示前5页的
	PageInfo  pageInfo=new PageInfo(students,5);
	
	model.addAttribute("pageInfo", pageInfo);
	return relsut;
	
}

}
